//alert("Hello class13!");

function postDate() {
    //Get the date from the form
    const handleSubmit = (event) => {
event.preventDefault();
    
const name = document.getElementById("Username").value;
const location = document.getElementById("Password").value;
const difficulty =document.getElementById("Email").value
const newHike = {
    Username : Username,
    Password : Password,
    Email : Email,

};
     let hikes = localStorage.getItem('hikes');
        if (!hikes) {
        // Create a new hikes object if it doesn't exist
        hikes = {
        "hikes": []
        };
    } else {
        hikes = JSON.parse(hikes);
}
        //Addto list og hikes
        hikes.hikes.push(newHike);
        //Save to database (local storage)
        localStorage.setItem('hikes',JSON.stringify(hikes));
         // console.log(name);
    }

    const form = document.getElementById("newHikeForm");
    form.addEventListener('submit',handleSubmit);

}

postDate();